package com.twu.biblioteca;

import org.xml.sax.SAXException;

import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * User: Anbu
 * Date: 10/2/13
 * Time: 11:00 PM
 * To change this template use File | Settings | File Templates.
 */
public class DataLoader {

    private DataReader reader;

    public DataLoader(DataReader dataReader) {
        this.reader = dataReader;
    }

    public void loadBookData(Library library) {
        reader.loadBookData(library);
    }

    public void loadMovieData(Library library) {
        reader.loadMovieData(library);
    }

    public static DataLoader buildDataLoader() throws ParserConfigurationException, SAXException, IOException {
        DataLoader dataLoader = new DataLoader(XMLDataReader.buildXMLDataReader("data.xml"));
        return dataLoader;
    }
}
